<%--
  User: Shengzhao Li
  Date: 13-10-2
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="displaytag" uri="http://displaytag.sf.net" %>
<html>
<head>
    <title>Meeting</title>
    <link href="${contextPath}/js/web/bootstrap/datepicker/datepicker.css" rel="stylesheet"/>
    <script src="${contextPath}/js/web/bootstrap/datepicker/bootstrap-datepicker.js"></script>

    <script src="${contextPath}/js/web/ckeditor/ckeditor.js"></script>
</head>
<body>
<div class="row">
    <hr/>
    <div class="span6">
        <form:form id="sprintMeetingSearchForm" method="get" cssClass="form-inline" commandName="overviewDto">
            <select name="sprintGuid" id="sprintSelect">
                <c:forEach items="${overviewDto.sprintDtosGroupResults}" var="group" varStatus="status">
                    <optgroup label="${group.key.label}">
                        <c:forEach items="${group.results}" var="sprint">
                            <option value="${sprint.guid}" ${sprint.guid eq overviewDto.sprintGuid?'selected':''}>${sprint.name}</option>
                        </c:forEach>
                    </optgroup>
                </c:forEach>
            </select>
            <form:select path="type" cssStyle="width: 150px;">
                <option value="">All types</option>
                <form:options items="${overviewDto.types}" itemLabel="label" itemValue="value"/>
            </form:select>
            <input type="submit" value="Search" class="btn btn-small"/>
        </form:form>
    </div>
    <div class="span3">
        &nbsp;
    </div>
    <div class="span3">
        <a href="javascript:void(0);" id="sprintMeetingFormId"
           load-url="${contextPath}/developer/sprint/meeting_form/create?sprintGuid=${overviewDto.sprintGuid}"
           class="btn btn-success btn-small"><i
                class="icon-plus icon-white"></i> Add meeting</a>

        <div class="btn-group">
            <a class="btn btn-small dropdown-toggle" data-toggle="dropdown" href="#">
                Back to <span class="caret"></span>
            </a>
            <ul class="dropdown-menu">
                <li><a href="${contextPath}/developer?currentSprint.guid=${overviewDto.sprintGuid}"><i
                        class="icon-th-list"></i> Tasks</a></li>
                <li><a href="${contextPath}/developer/sprint_overview"><i class="icon-road"></i> Sprints</a></li>
            </ul>
        </div>
    </div>
</div>
<div class="row">
    <div class="span12">
        <div class="alert alert-success hide">
            <button type="button" class="close" data-dismiss="alert">&times;</button>
            <div><i class="icon-ok-sign icon-white"></i>
                <span id="addMeetingSuccess" class="hide">Add/Edit sprint meeting successful!</span>

            </div>
        </div>
        <div class="alert alert-info hide">
            <button type="button" class="close" data-dismiss="alert">&times;</button>
            <div><i class="icon-info-sign icon-white"></i>
                <%--<span id="taskFormSuccess" class="hide">Create/Edit the task successful!</span>--%>
            </div>
        </div>
        <div class="alert alert-error hide">
            <button type="button" class="close" data-dismiss="alert">&times;</button>
            <div><i class="icon-warning-sign icon-white"></i>
                <%--<span id="alertErrorInfo"></span>--%>
            </div>
        </div>
    </div>
</div>
<div class="row">
    <div class="span9">
        <displaytag:table list="${overviewDto}" class="table table-hover" id="meeting"
                          form="sprintMeetingSearchForm">
            <displaytag:column title="Date" property="meetingDate"/>
            <displaytag:column title="Type" property="type.label" class="${meeting.type}"/>
            <displaytag:column title="Create time" property="createTime"/>
            <displaytag:column title="&nbsp;">
                <a href="javascript:void(0);" class="meetingEdit" title="Edit meeting"
                   load-url="${contextPath}/developer/sprint/meeting_form/${meeting.guid}?sprintGuid=${meeting.sprintDto.guid}"><i
                        class="icon-edit"></i></a>
                <a href="javascript:void(0);" class="meetingDetails" title="Meeting details"
                   load-url="${contextPath}/developer/sprint_meeting/details/${meeting.guid}"><i
                        class="icon-info-sign"></i></a>
            </displaytag:column>
        </displaytag:table>
    </div>
    <div class="span3">
        <div class="well">
            <div>
                <h5><a href="javascript:void(0);">Legend</a></h5>
            </div>

            <div>
                <table class="table">
                    <tr class="info">
                        <td>Daily standing</td>
                    </tr>
                    <tr class="success">
                        <td>Sprint review</td>
                    </tr>
                    <tr style="background-color: white;">
                        <td>Retrospective</td>
                    </tr>
                    <tr class="warning">
                        <td>Sprint planning</td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        new SprintMeetingOverview("${param.alert}");
    });
</script>
</body>
</html>